﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-39155502-5"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
  
      gtag('config', 'UA-39155502-5');
    </script>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class DBContext
   | MongoDB.Entities </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class DBContext
   | MongoDB.Entities ">
    <meta name="generator" content="docfx 2.58.0.0">
    <meta name="description" content="A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management.">
    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">
    
    <meta property="docfx:rel" content="../">
    <meta property="docfx:newtab" content="true">
    <meta property="og:title" content="MongoDB.Entities">
    <meta property="og:site_name" content="MongoDB.Entities">
    <meta property="og:url" content="https://mongodb-entities.com">
    <meta property="og:description" content="A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management,">
    <meta property="og:type" content="website">
    <meta property="og:image" content="https://mongodb-entities.com/images/social-square.png">  
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../index.html">
                <img id="logo" class="svg" src="../images/icon.png" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div class="container body-content">
        
        <div id="search-results">
          <div class="search-list">Search Results for <span></span></div>
          <div class="sr-items">
            <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
          </div>
          <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
        </div>
      </div>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="MongoDB.Entities.DBContext">
  
  
  <h1 id="MongoDB_Entities_DBContext" data-uid="MongoDB.Entities.DBContext" class="text-break">Class DBContext
  </h1>
  <div class="markdown level0 summary"><p>This db context class can be used as an alternative entry point instead of the DB static class.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><span class="xref">System.Object</span></div>
    <div class="level1"><span class="xref">DBContext</span></div>
      <div class="level2"><a class="xref" href="MongoDB.Entities.Transaction.html">Transaction</a></div>
  </div>
  <div class="inheritedMembers">
    <h5>Inherited Members</h5>
    <div>
      <span class="xref">System.Object.Equals(System.Object)</span>
    </div>
    <div>
      <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
    </div>
    <div>
      <span class="xref">System.Object.GetHashCode()</span>
    </div>
    <div>
      <span class="xref">System.Object.GetType()</span>
    </div>
    <div>
      <span class="xref">System.Object.MemberwiseClone()</span>
    </div>
    <div>
      <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
    </div>
    <div>
      <span class="xref">System.Object.ToString()</span>
    </div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="MongoDB.Entities.html">MongoDB.Entities</a></h6>
  <h6><strong>Assembly</strong>: MongoDB.Entities.dll</h6>
  <h5 id="MongoDB_Entities_DBContext_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class DBContext</code></pre>
  </div>
  <h3 id="constructors">Constructors
  </h3>
  
  
  <a id="MongoDB_Entities_DBContext__ctor_" data-uid="MongoDB.Entities.DBContext.#ctor*"></a>
  <h4 id="MongoDB_Entities_DBContext__ctor_MongoDB_Entities_ModifiedBy_" data-uid="MongoDB.Entities.DBContext.#ctor(MongoDB.Entities.ModifiedBy)">DBContext(ModifiedBy)</h4>
  <div class="markdown level1 summary"><p>Instantiates a DBContext instance</p>
<p>TIP: will throw an error if no connections have been initialized</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DBContext(ModifiedBy modifiedBy = null)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.ModifiedBy.html">ModifiedBy</a></td>
        <td><span class="parametername">modifiedBy</span></td>
        <td><p>An optional ModifiedBy instance.
When supplied, all save/update operations performed via this DBContext instance will set the value on entities that has a property of type ModifiedBy.
You can even inherit from the ModifiedBy class and add your own properties to it.
Only one ModifiedBy property is allowed on a single entity type.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext__ctor_" data-uid="MongoDB.Entities.DBContext.#ctor*"></a>
  <h4 id="MongoDB_Entities_DBContext__ctor_System_String_MongoDB_Driver_MongoClientSettings_MongoDB_Entities_ModifiedBy_" data-uid="MongoDB.Entities.DBContext.#ctor(System.String,MongoDB.Driver.MongoClientSettings,MongoDB.Entities.ModifiedBy)">DBContext(String, MongoClientSettings, ModifiedBy)</h4>
  <div class="markdown level1 summary"><p>Initializes a DBContext instance with the given connection parameters.</p>
<p>TIP: network connection is deferred until the first actual operation.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DBContext(string database, MongoClientSettings settings, ModifiedBy modifiedBy = null)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">database</span></td>
        <td><p>Name of the database</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.MongoClientSettings</span></td>
        <td><span class="parametername">settings</span></td>
        <td><p>A MongoClientSettings object</p>
</td>
      </tr>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.ModifiedBy.html">ModifiedBy</a></td>
        <td><span class="parametername">modifiedBy</span></td>
        <td><p>An optional ModifiedBy instance.
When supplied, all save/update operations performed via this DBContext instance will set the value on entities that has a property of type ModifiedBy.
You can even inherit from the ModifiedBy class and add your own properties to it.
Only one ModifiedBy property is allowed on a single entity type.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext__ctor_" data-uid="MongoDB.Entities.DBContext.#ctor*"></a>
  <h4 id="MongoDB_Entities_DBContext__ctor_System_String_System_String_System_Int32_MongoDB_Entities_ModifiedBy_" data-uid="MongoDB.Entities.DBContext.#ctor(System.String,System.String,System.Int32,MongoDB.Entities.ModifiedBy)">DBContext(String, String, Int32, ModifiedBy)</h4>
  <div class="markdown level1 summary"><p>Initializes a DBContext instance with the given connection parameters.</p>
<p>TIP: network connection is deferred until the first actual operation.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DBContext(string database, string host = &quot;127.0.0.1&quot;, int port = 27017, ModifiedBy modifiedBy = null)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">database</span></td>
        <td><p>Name of the database</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">host</span></td>
        <td><p>Address of the MongoDB server</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><span class="parametername">port</span></td>
        <td><p>Port number of the server</p>
</td>
      </tr>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.ModifiedBy.html">ModifiedBy</a></td>
        <td><span class="parametername">modifiedBy</span></td>
        <td><p>An optional ModifiedBy instance.
When supplied, all save/update operations performed via this DBContext instance will set the value on entities that has a property of type ModifiedBy.
You can even inherit from the ModifiedBy class and add your own properties to it.
Only one ModifiedBy property is allowed on a single entity type.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
  </h3>
  
  
  <a id="MongoDB_Entities_DBContext_ModifiedBy_" data-uid="MongoDB.Entities.DBContext.ModifiedBy*"></a>
  <h4 id="MongoDB_Entities_DBContext_ModifiedBy" data-uid="MongoDB.Entities.DBContext.ModifiedBy">ModifiedBy</h4>
  <div class="markdown level1 summary"><p>The value of this property will be automatically set on entities when saving/updating if the entity has a ModifiedBy property</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public ModifiedBy ModifiedBy { get; set; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.ModifiedBy.html">ModifiedBy</a></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Session_" data-uid="MongoDB.Entities.DBContext.Session*"></a>
  <h4 id="MongoDB_Entities_DBContext_Session" data-uid="MongoDB.Entities.DBContext.Session">Session</h4>
  <div class="markdown level1 summary"><p>Returns the session object used for transactions</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IClientSessionHandle Session { get; protected set; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IClientSessionHandle</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
  </h3>
  
  
  <a id="MongoDB_Entities_DBContext_AbortAsync_" data-uid="MongoDB.Entities.DBContext.AbortAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_AbortAsync_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.AbortAsync(System.Threading.CancellationToken)">AbortAsync(CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Aborts and rolls back a transaction</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task AbortAsync(CancellationToken cancellation = default(CancellationToken))</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CommitAsync_" data-uid="MongoDB.Entities.DBContext.CommitAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CommitAsync_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.CommitAsync(System.Threading.CancellationToken)">CommitAsync(CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Commits a transaction to MongoDB</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task CommitAsync(CancellationToken cancellation = default(CancellationToken))</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CountAsync_" data-uid="MongoDB.Entities.DBContext.CountAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CountAsync__1_MongoDB_Driver_FilterDefinition___0__System_Threading_CancellationToken_MongoDB_Driver_CountOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.CountAsync``1(MongoDB.Driver.FilterDefinition{``0},System.Threading.CancellationToken,MongoDB.Driver.CountOptions,System.Boolean)">CountAsync&lt;T&gt;(FilterDefinition&lt;T&gt;, CancellationToken, CountOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Gets an accurate count of how many total entities are in the collection for a given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;long&gt; CountAsync&lt;T&gt;(FilterDefinition&lt;T&gt; filter, CancellationToken cancellation = default(CancellationToken), CountOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>A filter definition</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.CountOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>An optional CountOptions object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to get the count for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CountAsync_" data-uid="MongoDB.Entities.DBContext.CountAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CountAsync__1_System_Func_MongoDB_Driver_FilterDefinitionBuilder___0__MongoDB_Driver_FilterDefinition___0___System_Threading_CancellationToken_MongoDB_Driver_CountOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.CountAsync``1(System.Func{MongoDB.Driver.FilterDefinitionBuilder{``0},MongoDB.Driver.FilterDefinition{``0}},System.Threading.CancellationToken,MongoDB.Driver.CountOptions,System.Boolean)">CountAsync&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt;, CancellationToken, CountOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Gets an accurate count of how many total entities are in the collection for a given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;long&gt; CountAsync&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt; filter, CancellationToken cancellation = default(CancellationToken), CountOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Func</span>&lt;<span class="xref">MongoDB.Driver.FilterDefinitionBuilder</span>&lt;T&gt;, <span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>f =&gt; f.Eq(x =&gt; x.Prop, Value) &amp; f.Gt(x =&gt; x.Prop, Value)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.CountOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>An optional CountOptions object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to get the count for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CountAsync_" data-uid="MongoDB.Entities.DBContext.CountAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CountAsync__1_System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Threading_CancellationToken_MongoDB_Driver_CountOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.CountAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Threading.CancellationToken,MongoDB.Driver.CountOptions,System.Boolean)">CountAsync&lt;T&gt;(Expression&lt;Func&lt;T, Boolean&gt;&gt;, CancellationToken, CountOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Gets an accurate count of how many entities are matched for a given expression/filter</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;long&gt; CountAsync&lt;T&gt;(Expression&lt;Func&lt;T, bool&gt;&gt; expression, CancellationToken cancellation = default(CancellationToken), CountOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Boolean</span>&gt;&gt;</td>
        <td><span class="parametername">expression</span></td>
        <td><p>A lambda expression for getting the count for a subset of the data</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.CountOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>An optional CountOptions object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to get the count for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CountAsync_" data-uid="MongoDB.Entities.DBContext.CountAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CountAsync__1_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.CountAsync``1(System.Threading.CancellationToken)">CountAsync&lt;T&gt;(CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Gets an accurate count of how many total entities are in the collection for a given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;long&gt; CountAsync&lt;T&gt;(CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to get the count for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CountEstimatedAsync_" data-uid="MongoDB.Entities.DBContext.CountEstimatedAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CountEstimatedAsync__1_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.CountEstimatedAsync``1(System.Threading.CancellationToken)">CountEstimatedAsync&lt;T&gt;(CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Gets a fast estimation of how many documents are in the collection using metadata.</p>
<p>HINT: The estimation may not be exactly accurate.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;long&gt; CountEstimatedAsync&lt;T&gt;(CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to get the count for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_CreateCollectionAsync_" data-uid="MongoDB.Entities.DBContext.CreateCollectionAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_CreateCollectionAsync__1_System_Action_MongoDB_Driver_CreateCollectionOptions___0___System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.CreateCollectionAsync``1(System.Action{MongoDB.Driver.CreateCollectionOptions{``0}},System.Threading.CancellationToken)">CreateCollectionAsync&lt;T&gt;(Action&lt;CreateCollectionOptions&lt;T&gt;&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Creates a collection for an Entity type explicitly using the given options</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task CreateCollectionAsync&lt;T&gt;(Action&lt;CreateCollectionOptions&lt;T&gt;&gt; options, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Action</span>&lt;<span class="xref">MongoDB.Driver.CreateCollectionOptions</span>&lt;T&gt;&gt;</td>
        <td><span class="parametername">options</span></td>
        <td><p>The options to use for collection creation</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity that will be stored in the created collection</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DeleteAsync_" data-uid="MongoDB.Entities.DBContext.DeleteAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DeleteAsync__1_MongoDB_Driver_FilterDefinition___0__System_Threading_CancellationToken_MongoDB_Driver_Collation_System_Boolean_" data-uid="MongoDB.Entities.DBContext.DeleteAsync``1(MongoDB.Driver.FilterDefinition{``0},System.Threading.CancellationToken,MongoDB.Driver.Collation,System.Boolean)">DeleteAsync&lt;T&gt;(FilterDefinition&lt;T&gt;, CancellationToken, Collation, Boolean)</h4>
  <div class="markdown level1 summary"><p>Deletes matching entities with a filter definition</p>
<p>HINT: If the expression matches more than 100,000 entities, they will be deleted in batches of 100k.</p>
<p>HINT: If these entities are referenced by one-to-many/many-to-many relationships, those references are also deleted.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;DeleteResult&gt; DeleteAsync&lt;T&gt;(FilterDefinition&lt;T&gt; filter, CancellationToken cancellation = default(CancellationToken), Collation collation = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>A filter definition for matching entities to delete.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.Collation</span></td>
        <td><span class="parametername">collation</span></td>
        <td><p>An optional collation object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.DeleteResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DeleteAsync_" data-uid="MongoDB.Entities.DBContext.DeleteAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DeleteAsync__1_System_Collections_Generic_IEnumerable_System_String__System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.DeleteAsync``1(System.Collections.Generic.IEnumerable{System.String},System.Threading.CancellationToken,System.Boolean)">DeleteAsync&lt;T&gt;(IEnumerable&lt;String&gt;, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Deletes matching entities from MongoDB</p>
<p>HINT: If these entities are referenced by one-to-many/many-to-many relationships, those references are also deleted.</p>
<p>TIP: Try to keep the number of entities to delete under 100 in a single call</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;DeleteResult&gt; DeleteAsync&lt;T&gt;(IEnumerable&lt;string&gt; IDs, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.String</span>&gt;</td>
        <td><span class="parametername">IDs</span></td>
        <td><p>An IEnumerable of entity IDs</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.DeleteResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DeleteAsync_" data-uid="MongoDB.Entities.DBContext.DeleteAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DeleteAsync__1_System_Func_MongoDB_Driver_FilterDefinitionBuilder___0__MongoDB_Driver_FilterDefinition___0___System_Threading_CancellationToken_MongoDB_Driver_Collation_System_Boolean_" data-uid="MongoDB.Entities.DBContext.DeleteAsync``1(System.Func{MongoDB.Driver.FilterDefinitionBuilder{``0},MongoDB.Driver.FilterDefinition{``0}},System.Threading.CancellationToken,MongoDB.Driver.Collation,System.Boolean)">DeleteAsync&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt;, CancellationToken, Collation, Boolean)</h4>
  <div class="markdown level1 summary"><p>Deletes matching entities with a filter expression</p>
<p>HINT: If the expression matches more than 100,000 entities, they will be deleted in batches of 100k.</p>
<p>HINT: If these entities are referenced by one-to-many/many-to-many relationships, those references are also deleted.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;DeleteResult&gt; DeleteAsync&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt; filter, CancellationToken cancellation = default(CancellationToken), Collation collation = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Func</span>&lt;<span class="xref">MongoDB.Driver.FilterDefinitionBuilder</span>&lt;T&gt;, <span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>f =&gt; f.Eq(x =&gt; x.Prop, Value) &amp; f.Gt(x =&gt; x.Prop, Value)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.Collation</span></td>
        <td><span class="parametername">collation</span></td>
        <td><p>An optional collation object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.DeleteResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DeleteAsync_" data-uid="MongoDB.Entities.DBContext.DeleteAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DeleteAsync__1_System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Threading_CancellationToken_MongoDB_Driver_Collation_System_Boolean_" data-uid="MongoDB.Entities.DBContext.DeleteAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Threading.CancellationToken,MongoDB.Driver.Collation,System.Boolean)">DeleteAsync&lt;T&gt;(Expression&lt;Func&lt;T, Boolean&gt;&gt;, CancellationToken, Collation, Boolean)</h4>
  <div class="markdown level1 summary"><p>Deletes matching entities from MongoDB</p>
<p>HINT: If these entities are referenced by one-to-many/many-to-many relationships, those references are also deleted.</p>
<p>TIP: Try to keep the number of entities to delete under 100 in a single call</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;DeleteResult&gt; DeleteAsync&lt;T&gt;(Expression&lt;Func&lt;T, bool&gt;&gt; expression, CancellationToken cancellation = default(CancellationToken), Collation collation = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Boolean</span>&gt;&gt;</td>
        <td><span class="parametername">expression</span></td>
        <td><p>A lambda expression for matching entities to delete.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.Collation</span></td>
        <td><span class="parametername">collation</span></td>
        <td><p>An optional collation object</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.DeleteResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DeleteAsync_" data-uid="MongoDB.Entities.DBContext.DeleteAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DeleteAsync__1_System_String_System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.DeleteAsync``1(System.String,System.Threading.CancellationToken,System.Boolean)">DeleteAsync&lt;T&gt;(String, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Deletes a single entity from MongoDB</p>
<p>HINT: If this entity is referenced by one-to-many/many-to-many relationships, those references are also deleted.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;DeleteResult&gt; DeleteAsync&lt;T&gt;(string ID, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">ID</span></td>
        <td><p>The Id of the entity to delete</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.DeleteResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Distinct_" data-uid="MongoDB.Entities.DBContext.Distinct*"></a>
  <h4 id="MongoDB_Entities_DBContext_Distinct__2" data-uid="MongoDB.Entities.DBContext.Distinct``2">Distinct&lt;T, TProperty&gt;()</h4>
  <div class="markdown level1 summary"><p>Represents a MongoDB Distinct command where you can get back distinct values for a given property of a given Entity</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Distinct&lt;T, TProperty&gt; Distinct&lt;T, TProperty&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Distinct-2.html">Distinct</a>&lt;T, TProperty&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any Entity that implements IEntity interface</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TProperty</span></td>
        <td><p>The type of the property of the entity you'd like to get unique values for</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_DropCollectionAsync_" data-uid="MongoDB.Entities.DBContext.DropCollectionAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_DropCollectionAsync__1" data-uid="MongoDB.Entities.DBContext.DropCollectionAsync``1">DropCollectionAsync&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Deletes the collection of a given entity type as well as the join collections for that entity.</p>
<p>TIP: When deleting a collection, all relationships associated with that entity type is also deleted.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task DropCollectionAsync&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to drop the collection of</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Find_" data-uid="MongoDB.Entities.DBContext.Find*"></a>
  <h4 id="MongoDB_Entities_DBContext_Find__1" data-uid="MongoDB.Entities.DBContext.Find``1">Find&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts a find command for the given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Find&lt;T&gt; Find&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Find-1.html">Find</a>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Find_" data-uid="MongoDB.Entities.DBContext.Find*"></a>
  <h4 id="MongoDB_Entities_DBContext_Find__2" data-uid="MongoDB.Entities.DBContext.Find``2">Find&lt;T, TProjection&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts a find command with projection support for the given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Find&lt;T, TProjection&gt; Find&lt;T, TProjection&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Find-2.html">Find</a>&lt;T, TProjection&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TProjection</span></td>
        <td><p>The type of the end result</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Fluent_" data-uid="MongoDB.Entities.DBContext.Fluent*"></a>
  <h4 id="MongoDB_Entities_DBContext_Fluent__1_MongoDB_Driver_AggregateOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.Fluent``1(MongoDB.Driver.AggregateOptions,System.Boolean)">Fluent&lt;T&gt;(AggregateOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Exposes the MongoDB collection for the given entity type as IAggregateFluent in order to facilitate Fluent queries</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IAggregateFluent&lt;T&gt; Fluent&lt;T&gt;(AggregateOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IAggregateFluent</span>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_FluentTextSearch_" data-uid="MongoDB.Entities.DBContext.FluentTextSearch*"></a>
  <h4 id="MongoDB_Entities_DBContext_FluentTextSearch__1_MongoDB_Entities_Search_System_String_System_Boolean_System_Boolean_System_String_MongoDB_Driver_AggregateOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.FluentTextSearch``1(MongoDB.Entities.Search,System.String,System.Boolean,System.Boolean,System.String,MongoDB.Driver.AggregateOptions,System.Boolean)">FluentTextSearch&lt;T&gt;(Search, String, Boolean, Boolean, String, AggregateOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Start a fluent aggregation pipeline with a $text stage with the supplied parameters</p>
<p>TIP: Make sure to define a text index with DB.Index&lt;T>() before searching</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IAggregateFluent&lt;T&gt; FluentTextSearch&lt;T&gt;(Search searchType, string searchTerm, bool caseSensitive = false, bool diacriticSensitive = false, string language = null, AggregateOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Search.html">Search</a></td>
        <td><span class="parametername">searchType</span></td>
        <td><p>The type of text matching to do</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">searchTerm</span></td>
        <td><p>The search term</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">caseSensitive</span></td>
        <td><p>Case sensitivity of the search (optional)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">diacriticSensitive</span></td>
        <td><p>Diacritic sensitivity of the search (optional)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">language</span></td>
        <td><p>The language for the search (optional)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>Options for finding documents (not required)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IAggregateFluent</span>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_GeoNear_" data-uid="MongoDB.Entities.DBContext.GeoNear*"></a>
  <h4 id="MongoDB_Entities_DBContext_GeoNear__1_MongoDB_Entities_Coordinates2D_System_Linq_Expressions_Expression_System_Func___0_System_Object___System_Boolean_System_Nullable_System_Int32__System_Nullable_System_Int32__System_Nullable_System_Int32__MongoDB_Bson_BsonDocument_System_Nullable_System_Int32__System_Linq_Expressions_Expression_System_Func___0_System_Object___System_String_MongoDB_Driver_AggregateOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.GeoNear``1(MongoDB.Entities.Coordinates2D,System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},MongoDB.Bson.BsonDocument,System.Nullable{System.Int32},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String,MongoDB.Driver.AggregateOptions,System.Boolean)">GeoNear&lt;T&gt;(Coordinates2D, Expression&lt;Func&lt;T, Object&gt;&gt;, Boolean, Nullable&lt;Int32&gt;, Nullable&lt;Int32&gt;, Nullable&lt;Int32&gt;, BsonDocument, Nullable&lt;Int32&gt;, Expression&lt;Func&lt;T, Object&gt;&gt;, String, AggregateOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Start a fluent aggregation pipeline with a $GeoNear stage with the supplied parameters</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IAggregateFluent&lt;T&gt; GeoNear&lt;T&gt;(Coordinates2D NearCoordinates, Expression&lt;Func&lt;T, object&gt;&gt; DistanceField, bool Spherical = true, int? MaxDistance = default(int? ), int? MinDistance = default(int? ), int? Limit = default(int? ), BsonDocument Query = null, int? DistanceMultiplier = default(int? ), Expression&lt;Func&lt;T, object&gt;&gt; IncludeLocations = null, string IndexKey = null, AggregateOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Coordinates2D.html">Coordinates2D</a></td>
        <td><span class="parametername">NearCoordinates</span></td>
        <td><p>The coordinates from which to find documents from</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">DistanceField</span></td>
        <td><p>x =&gt; x.Distance</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">Spherical</span></td>
        <td><p>Calculate distances using spherical geometry or not</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.Int32</span>&gt;</td>
        <td><span class="parametername">MaxDistance</span></td>
        <td><p>The maximum distance in meters from the center point that the documents can be</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.Int32</span>&gt;</td>
        <td><span class="parametername">MinDistance</span></td>
        <td><p>The minimum distance in meters from the center point that the documents can be</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.Int32</span>&gt;</td>
        <td><span class="parametername">Limit</span></td>
        <td><p>The maximum number of documents to return</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Bson.BsonDocument</span></td>
        <td><span class="parametername">Query</span></td>
        <td><p>Limits the results to the documents that match the query</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.Int32</span>&gt;</td>
        <td><span class="parametername">DistanceMultiplier</span></td>
        <td><p>The factor to multiply all distances returned by the query</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">IncludeLocations</span></td>
        <td><p>Specify the output field to store the point used to calculate the distance</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">IndexKey</span></td>
        <td></td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IAggregateFluent</span>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_InsertAsync_" data-uid="MongoDB.Entities.DBContext.InsertAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_InsertAsync__1___0_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.InsertAsync``1(``0,System.Threading.CancellationToken)">InsertAsync&lt;T&gt;(T, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a complete entity replacing an existing entity or creating a new one if it does not exist.
If ID value is null, a new entity is created. If ID has a value, then existing entity is replaced.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task InsertAsync&lt;T&gt;(T entity, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">entity</span></td>
        <td><p>The instance to persist</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>And optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_InsertAsync_" data-uid="MongoDB.Entities.DBContext.InsertAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_InsertAsync__1_System_Collections_Generic_IEnumerable___0__System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.InsertAsync``1(System.Collections.Generic.IEnumerable{``0},System.Threading.CancellationToken)">InsertAsync&lt;T&gt;(IEnumerable&lt;T&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a batch of complete entities replacing an existing entities or creating a new ones if they do not exist.
If ID value is null, a new entity is created. If ID has a value, then existing entity is replaced.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;BulkWriteResult&lt;T&gt;&gt; InsertAsync&lt;T&gt;(IEnumerable&lt;T&gt; entities, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">entities</span></td>
        <td><p>The entities to persist</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>And optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.BulkWriteResult</span>&lt;T&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_OnBeforeSave_" data-uid="MongoDB.Entities.DBContext.OnBeforeSave*"></a>
  <h4 id="MongoDB_Entities_DBContext_OnBeforeSave__1" data-uid="MongoDB.Entities.DBContext.OnBeforeSave``1">OnBeforeSave&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>This event hook will be trigged right before an entity is persisted</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected virtual Action&lt;T&gt; OnBeforeSave&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Action</span>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any entity that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_OnBeforeUpdate_" data-uid="MongoDB.Entities.DBContext.OnBeforeUpdate*"></a>
  <h4 id="MongoDB_Entities_DBContext_OnBeforeUpdate__1" data-uid="MongoDB.Entities.DBContext.OnBeforeUpdate``1">OnBeforeUpdate&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>This event hook will be triggered right before an update/replace command is executed</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected virtual Action&lt;UpdateBase&lt;T&gt;&gt; OnBeforeUpdate&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Action</span>&lt;<a class="xref" href="MongoDB.Entities.UpdateBase-1.html">UpdateBase</a>&lt;T&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any entity that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PagedSearch_" data-uid="MongoDB.Entities.DBContext.PagedSearch*"></a>
  <h4 id="MongoDB_Entities_DBContext_PagedSearch__1" data-uid="MongoDB.Entities.DBContext.PagedSearch``1">PagedSearch&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Represents an aggregation query that retrieves results with easy paging support.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public PagedSearch&lt;T&gt; PagedSearch&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.PagedSearch-1.html">PagedSearch</a>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PagedSearch_" data-uid="MongoDB.Entities.DBContext.PagedSearch*"></a>
  <h4 id="MongoDB_Entities_DBContext_PagedSearch__2" data-uid="MongoDB.Entities.DBContext.PagedSearch``2">PagedSearch&lt;T, TProjection&gt;()</h4>
  <div class="markdown level1 summary"><p>Represents an aggregation query that retrieves results with easy paging support.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public PagedSearch&lt;T, TProjection&gt; PagedSearch&lt;T, TProjection&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.PagedSearch-2.html">PagedSearch</a>&lt;T, TProjection&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TProjection</span></td>
        <td><p>The type you'd like to project the results to.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PipelineAsync_" data-uid="MongoDB.Entities.DBContext.PipelineAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_PipelineAsync__2_MongoDB_Entities_Template___0___1__MongoDB_Driver_AggregateOptions_System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.PipelineAsync``2(MongoDB.Entities.Template{``0,``1},MongoDB.Driver.AggregateOptions,System.Threading.CancellationToken,System.Boolean)">PipelineAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt;, AggregateOptions, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Executes an aggregation pipeline by supplying a 'Template' object.
Gets a list back as the result.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;List&lt;TResult&gt;&gt; PipelineAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt; template, AggregateOptions options = null, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Template-2.html">Template</a>&lt;T, TResult&gt;</td>
        <td><span class="parametername">template</span></td>
        <td><p>A 'Template' object with tags replaced</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">System.Collections.Generic.List</span>&lt;TResult&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TResult</span></td>
        <td><p>The type of the resulting objects</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PipelineCursorAsync_" data-uid="MongoDB.Entities.DBContext.PipelineCursorAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_PipelineCursorAsync__2_MongoDB_Entities_Template___0___1__MongoDB_Driver_AggregateOptions_System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.PipelineCursorAsync``2(MongoDB.Entities.Template{``0,``1},MongoDB.Driver.AggregateOptions,System.Threading.CancellationToken,System.Boolean)">PipelineCursorAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt;, AggregateOptions, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Executes an aggregation pipeline by supplying a 'Template' object.
Gets a cursor back as the result.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;IAsyncCursor&lt;TResult&gt;&gt; PipelineCursorAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt; template, AggregateOptions options = null, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Template-2.html">Template</a>&lt;T, TResult&gt;</td>
        <td><span class="parametername">template</span></td>
        <td><p>A 'Template' object with tags replaced</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.IAsyncCursor</span>&lt;TResult&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TResult</span></td>
        <td><p>The type of the resulting objects</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PipelineFirstAsync_" data-uid="MongoDB.Entities.DBContext.PipelineFirstAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_PipelineFirstAsync__2_MongoDB_Entities_Template___0___1__MongoDB_Driver_AggregateOptions_System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.PipelineFirstAsync``2(MongoDB.Entities.Template{``0,``1},MongoDB.Driver.AggregateOptions,System.Threading.CancellationToken,System.Boolean)">PipelineFirstAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt;, AggregateOptions, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Executes an aggregation pipeline by supplying a 'Template' object.
Gets the first or default value as the result.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;TResult&gt; PipelineFirstAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt; template, AggregateOptions options = null, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Template-2.html">Template</a>&lt;T, TResult&gt;</td>
        <td><span class="parametername">template</span></td>
        <td><p>A 'Template' object with tags replaced</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;TResult&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TResult</span></td>
        <td><p>The type of the resulting objects</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_PipelineSingleAsync_" data-uid="MongoDB.Entities.DBContext.PipelineSingleAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_PipelineSingleAsync__2_MongoDB_Entities_Template___0___1__MongoDB_Driver_AggregateOptions_System_Threading_CancellationToken_System_Boolean_" data-uid="MongoDB.Entities.DBContext.PipelineSingleAsync``2(MongoDB.Entities.Template{``0,``1},MongoDB.Driver.AggregateOptions,System.Threading.CancellationToken,System.Boolean)">PipelineSingleAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt;, AggregateOptions, CancellationToken, Boolean)</h4>
  <div class="markdown level1 summary"><p>Executes an aggregation pipeline by supplying a 'Template' object.
Gets a single or default value as the result.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;TResult&gt; PipelineSingleAsync&lt;T, TResult&gt;(Template&lt;T, TResult&gt; template, AggregateOptions options = null, CancellationToken cancellation = default(CancellationToken), bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Template-2.html">Template</a>&lt;T, TResult&gt;</td>
        <td><span class="parametername">template</span></td>
        <td><p>A 'Template' object with tags replaced</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The options for the aggregation. This is not required.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;TResult&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TResult</span></td>
        <td><p>The type of the resulting objects</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Queryable_" data-uid="MongoDB.Entities.DBContext.Queryable*"></a>
  <h4 id="MongoDB_Entities_DBContext_Queryable__1_MongoDB_Driver_AggregateOptions_System_Boolean_" data-uid="MongoDB.Entities.DBContext.Queryable``1(MongoDB.Driver.AggregateOptions,System.Boolean)">Queryable&lt;T&gt;(AggregateOptions, Boolean)</h4>
  <div class="markdown level1 summary"><p>Exposes the MongoDB collection for the given entity type as IQueryable in order to facilitate LINQ queries</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IMongoQueryable&lt;T&gt; Queryable&lt;T&gt;(AggregateOptions options = null, bool ignoreGlobalFilters = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.AggregateOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>The aggregate options</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">ignoreGlobalFilters</span></td>
        <td><p>Set to true if you'd like to ignore any global filters for this operation</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.Linq.IMongoQueryable</span>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Replace_" data-uid="MongoDB.Entities.DBContext.Replace*"></a>
  <h4 id="MongoDB_Entities_DBContext_Replace__1" data-uid="MongoDB.Entities.DBContext.Replace``1">Replace&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts a replace command for the given entity type</p>
<p>TIP: Only the first matched entity will be replaced</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Replace&lt;T&gt; Replace&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Replace-1.html">Replace</a>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveAsync_" data-uid="MongoDB.Entities.DBContext.SaveAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveAsync__1___0_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveAsync``1(``0,System.Threading.CancellationToken)">SaveAsync&lt;T&gt;(T, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a complete entity replacing an existing entity or creating a new one if it does not exist.
If ID value is null, a new entity is created. If ID has a value, then existing entity is replaced.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task SaveAsync&lt;T&gt;(T entity, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">entity</span></td>
        <td><p>The instance to persist</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>And optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveAsync_" data-uid="MongoDB.Entities.DBContext.SaveAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveAsync__1_System_Collections_Generic_IEnumerable___0__System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveAsync``1(System.Collections.Generic.IEnumerable{``0},System.Threading.CancellationToken)">SaveAsync&lt;T&gt;(IEnumerable&lt;T&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a batch of complete entities replacing an existing entities or creating a new ones if they do not exist.
If ID value is null, a new entity is created. If ID has a value, then existing entity is replaced.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;BulkWriteResult&lt;T&gt;&gt; SaveAsync&lt;T&gt;(IEnumerable&lt;T&gt; entities, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">entities</span></td>
        <td><p>The entities to persist</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>And optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.BulkWriteResult</span>&lt;T&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveExceptAsync_" data-uid="MongoDB.Entities.DBContext.SaveExceptAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveExceptAsync__1___0_System_Linq_Expressions_Expression_System_Func___0_System_Object___System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveExceptAsync``1(``0,System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Threading.CancellationToken)">SaveExceptAsync&lt;T&gt;(T, Expression&lt;Func&lt;T, Object&gt;&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves an entity partially excluding the specified subset of properties.
If ID value is null, a new entity is created. If ID has a value, then existing entity is updated.</p>
<p>TIP: The properties to be excluded can be specified with a &apos;New&apos; expression. 
You can only specify root level properties with the expression.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;UpdateResult&gt; SaveExceptAsync&lt;T&gt;(T entity, Expression&lt;Func&lt;T, object&gt;&gt; members, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">entity</span></td>
        <td><p>The entity to save</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">members</span></td>
        <td><p>x =&gt; new { x.PropOne, x.PropTwo }</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.UpdateResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveExceptAsync_" data-uid="MongoDB.Entities.DBContext.SaveExceptAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveExceptAsync__1_System_Collections_Generic_IEnumerable___0__System_Linq_Expressions_Expression_System_Func___0_System_Object___System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveExceptAsync``1(System.Collections.Generic.IEnumerable{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Threading.CancellationToken)">SaveExceptAsync&lt;T&gt;(IEnumerable&lt;T&gt;, Expression&lt;Func&lt;T, Object&gt;&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a batch of entities partially excluding the specified subset of properties.
If ID value is null, a new entity is created. If ID has a value, then existing entity is updated.</p>
<p>TIP: The properties to be excluded can be specified with a &apos;New&apos; expression. 
You can only specify root level properties with the expression.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;BulkWriteResult&lt;T&gt;&gt; SaveExceptAsync&lt;T&gt;(IEnumerable&lt;T&gt; entities, Expression&lt;Func&lt;T, object&gt;&gt; members, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">entities</span></td>
        <td><p>The batch of entities to save</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">members</span></td>
        <td><p>x =&gt; new { x.PropOne, x.PropTwo }</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.BulkWriteResult</span>&lt;T&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveOnlyAsync_" data-uid="MongoDB.Entities.DBContext.SaveOnlyAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveOnlyAsync__1___0_System_Linq_Expressions_Expression_System_Func___0_System_Object___System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveOnlyAsync``1(``0,System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Threading.CancellationToken)">SaveOnlyAsync&lt;T&gt;(T, Expression&lt;Func&lt;T, Object&gt;&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves an entity partially with only the specified subset of properties.
If ID value is null, a new entity is created. If ID has a value, then existing entity is updated.</p>
<p>TIP: The properties to be saved can be specified with a &apos;New&apos; expression. 
You can only specify root level properties with the expression.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;UpdateResult&gt; SaveOnlyAsync&lt;T&gt;(T entity, Expression&lt;Func&lt;T, object&gt;&gt; members, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">entity</span></td>
        <td><p>The entity to save</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">members</span></td>
        <td><p>x =&gt; new { x.PropOne, x.PropTwo }</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.UpdateResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SaveOnlyAsync_" data-uid="MongoDB.Entities.DBContext.SaveOnlyAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SaveOnlyAsync__1_System_Collections_Generic_IEnumerable___0__System_Linq_Expressions_Expression_System_Func___0_System_Object___System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SaveOnlyAsync``1(System.Collections.Generic.IEnumerable{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Threading.CancellationToken)">SaveOnlyAsync&lt;T&gt;(IEnumerable&lt;T&gt;, Expression&lt;Func&lt;T, Object&gt;&gt;, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves a batch of entities partially with only the specified subset of properties.
If ID value is null, a new entity is created. If ID has a value, then existing entity is updated.</p>
<p>TIP: The properties to be saved can be specified with a &apos;New&apos; expression. 
You can only specify root level properties with the expression.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;BulkWriteResult&lt;T&gt;&gt; SaveOnlyAsync&lt;T&gt;(IEnumerable&lt;T&gt; entities, Expression&lt;Func&lt;T, object&gt;&gt; members, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">entities</span></td>
        <td><p>The batch of entities to save</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Object</span>&gt;&gt;</td>
        <td><span class="parametername">members</span></td>
        <td><p>x =&gt; new { x.PropOne, x.PropTwo }</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.BulkWriteResult</span>&lt;T&gt;&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>Any class that implements IEntity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SavePreservingAsync_" data-uid="MongoDB.Entities.DBContext.SavePreservingAsync*"></a>
  <h4 id="MongoDB_Entities_DBContext_SavePreservingAsync__1___0_System_Threading_CancellationToken_" data-uid="MongoDB.Entities.DBContext.SavePreservingAsync``1(``0,System.Threading.CancellationToken)">SavePreservingAsync&lt;T&gt;(T, CancellationToken)</h4>
  <div class="markdown level1 summary"><p>Saves an entity partially while excluding some properties
The properties to be excluded can be specified using the [Preserve] or [DontPreserve] attributes.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Task&lt;UpdateResult&gt; SavePreservingAsync&lt;T&gt;(T entity, CancellationToken cancellation = default(CancellationToken))

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">entity</span></td>
        <td><p>The entity to save</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Threading.CancellationToken</span></td>
        <td><span class="parametername">cancellation</span></td>
        <td><p>An optional cancellation token</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Threading.Tasks.Task</span>&lt;<span class="xref">MongoDB.Driver.UpdateResult</span>&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilter_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilter_System_Type_System_String_System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter(System.Type,System.String,System.Boolean)">SetGlobalFilter(Type, String, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilter(Type type, string jsonString, bool prepend = false)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Type</span></td>
        <td><span class="parametername">type</span></td>
        <td><p>The type of Entity this global filter should be applied to</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">jsonString</span></td>
        <td><p>A JSON string filter definition to be applied</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilter_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilter__1_MongoDB_Driver_FilterDefinition___0__System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter``1(MongoDB.Driver.FilterDefinition{``0},System.Boolean)">SetGlobalFilter&lt;T&gt;(FilterDefinition&lt;T&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilter&lt;T&gt;(FilterDefinition&lt;T&gt; filter, bool prepend = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>A filter definition to be applied</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of Entity this global filter should be applied to</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilter_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilter__1_System_Func_MongoDB_Driver_FilterDefinitionBuilder___0__MongoDB_Driver_FilterDefinition___0___System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter``1(System.Func{MongoDB.Driver.FilterDefinitionBuilder{``0},MongoDB.Driver.FilterDefinition{``0}},System.Boolean)">SetGlobalFilter&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilter&lt;T&gt;(Func&lt;FilterDefinitionBuilder&lt;T&gt;, FilterDefinition&lt;T&gt;&gt; filter, bool prepend = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Func</span>&lt;<span class="xref">MongoDB.Driver.FilterDefinitionBuilder</span>&lt;T&gt;, <span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;T&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>b =&gt; b.Eq(x =&gt; x.Prop1, &quot;some value&quot;)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of Entity this global filter should be applied to</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilter_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilter__1_System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilter``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean)">SetGlobalFilter&lt;T&gt;(Expression&lt;Func&lt;T, Boolean&gt;&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilter&lt;T&gt;(Expression&lt;Func&lt;T, bool&gt;&gt; filter, bool prepend = false)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;T, <span class="xref">System.Boolean</span>&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>x =&gt; x.Prop1 == &quot;some value&quot;</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of Entity this global filter should be applied to</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass__1_MongoDB_Driver_FilterDefinition___0__System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass``1(MongoDB.Driver.FilterDefinition{``0},System.Boolean)">SetGlobalFilterForBaseClass&lt;TBase&gt;(FilterDefinition&lt;TBase&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilterForBaseClass&lt;TBase&gt;(FilterDefinition&lt;TBase&gt; filter, bool prepend = false)

    where TBase : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;TBase&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>A filter definition to be applied</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">TBase</span></td>
        <td><p>The type of the base class</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass__1_System_Func_MongoDB_Driver_FilterDefinitionBuilder___0__MongoDB_Driver_FilterDefinition___0___System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass``1(System.Func{MongoDB.Driver.FilterDefinitionBuilder{``0},MongoDB.Driver.FilterDefinition{``0}},System.Boolean)">SetGlobalFilterForBaseClass&lt;TBase&gt;(Func&lt;FilterDefinitionBuilder&lt;TBase&gt;, FilterDefinition&lt;TBase&gt;&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilterForBaseClass&lt;TBase&gt;(Func&lt;FilterDefinitionBuilder&lt;TBase&gt;, FilterDefinition&lt;TBase&gt;&gt; filter, bool prepend = false)

    where TBase : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Func</span>&lt;<span class="xref">MongoDB.Driver.FilterDefinitionBuilder</span>&lt;TBase&gt;, <span class="xref">MongoDB.Driver.FilterDefinition</span>&lt;TBase&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>b =&gt; b.Eq(x =&gt; x.Prop1, &quot;some value&quot;)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">TBase</span></td>
        <td><p>The type of the base class</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilterForBaseClass__1_System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForBaseClass``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean)">SetGlobalFilterForBaseClass&lt;TBase&gt;(Expression&lt;Func&lt;TBase, Boolean&gt;&gt;, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter to be applied to all operations performed with this DBContext</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilterForBaseClass&lt;TBase&gt;(Expression&lt;Func&lt;TBase, bool&gt;&gt; filter, bool prepend = false)

    where TBase : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Linq.Expressions.Expression</span>&lt;<span class="xref">System.Func</span>&lt;TBase, <span class="xref">System.Boolean</span>&gt;&gt;</td>
        <td><span class="parametername">filter</span></td>
        <td><p>b =&gt; b.Eq(x =&gt; x.Prop1, &quot;some value&quot;)</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">TBase</span></td>
        <td><p>The type of the base class</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_SetGlobalFilterForInterface_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForInterface*"></a>
  <h4 id="MongoDB_Entities_DBContext_SetGlobalFilterForInterface__1_System_String_System_Boolean_" data-uid="MongoDB.Entities.DBContext.SetGlobalFilterForInterface``1(System.String,System.Boolean)">SetGlobalFilterForInterface&lt;TInterface&gt;(String, Boolean)</h4>
  <div class="markdown level1 summary"><p>Specify a global filter for all entity types that implements a given interface</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">protected void SetGlobalFilterForInterface&lt;TInterface&gt;(string jsonString, bool prepend = false)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">jsonString</span></td>
        <td><p>A JSON string filter definition to be applied</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><span class="parametername">prepend</span></td>
        <td><p>Set to true if you want to prepend this global filter to your operation filters instead of being appended</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">TInterface</span></td>
        <td><p>The interface type to target. Will throw if supplied argument is not an interface type</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Transaction_" data-uid="MongoDB.Entities.DBContext.Transaction*"></a>
  <h4 id="MongoDB_Entities_DBContext_Transaction_System_String_MongoDB_Driver_ClientSessionOptions_" data-uid="MongoDB.Entities.DBContext.Transaction(System.String,MongoDB.Driver.ClientSessionOptions)">Transaction(String, ClientSessionOptions)</h4>
  <div class="markdown level1 summary"><p>Starts a transaction and returns a session object.</p>
<p>WARNING: Only one transaction is allowed per DBContext instance. 
Call Session.Dispose() and assign a null to it before calling this method a second time. 
Trying to start a second transaction for this DBContext instance will throw an exception.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IClientSessionHandle Transaction(string database = null, ClientSessionOptions options = null)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.String</span></td>
        <td><span class="parametername">database</span></td>
        <td><p>The name of the database to use for this transaction. default db is used if not specified</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">MongoDB.Driver.ClientSessionOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>Client session options for this transaction</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IClientSessionHandle</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Transaction_" data-uid="MongoDB.Entities.DBContext.Transaction*"></a>
  <h4 id="MongoDB_Entities_DBContext_Transaction__1_MongoDB_Driver_ClientSessionOptions_" data-uid="MongoDB.Entities.DBContext.Transaction``1(MongoDB.Driver.ClientSessionOptions)">Transaction&lt;T&gt;(ClientSessionOptions)</h4>
  <div class="markdown level1 summary"><p>Starts a transaction and returns a session object for a given entity type.</p>
<p>WARNING: Only one transaction is allowed per DBContext instance. 
Call Session.Dispose() and assign a null to it before calling this method a second time. 
Trying to start a second transaction for this DBContext instance will throw an exception.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IClientSessionHandle Transaction&lt;T&gt;(ClientSessionOptions options = null)

    where T : IEntity</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.ClientSessionOptions</span></td>
        <td><span class="parametername">options</span></td>
        <td><p>Client session options (not required)</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">MongoDB.Driver.IClientSessionHandle</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The entity type to determine the database from for the transaction</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_Update_" data-uid="MongoDB.Entities.DBContext.Update*"></a>
  <h4 id="MongoDB_Entities_DBContext_Update__1" data-uid="MongoDB.Entities.DBContext.Update``1">Update&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts an update command for the given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Update&lt;T&gt; Update&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.Update-1.html">Update</a>&lt;T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_UpdateAndGet_" data-uid="MongoDB.Entities.DBContext.UpdateAndGet*"></a>
  <h4 id="MongoDB_Entities_DBContext_UpdateAndGet__1" data-uid="MongoDB.Entities.DBContext.UpdateAndGet``1">UpdateAndGet&lt;T&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts an update-and-get command for the given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public UpdateAndGet&lt;T, T&gt; UpdateAndGet&lt;T&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.UpdateAndGet-2.html">UpdateAndGet</a>&lt;T, T&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="MongoDB_Entities_DBContext_UpdateAndGet_" data-uid="MongoDB.Entities.DBContext.UpdateAndGet*"></a>
  <h4 id="MongoDB_Entities_DBContext_UpdateAndGet__2" data-uid="MongoDB.Entities.DBContext.UpdateAndGet``2">UpdateAndGet&lt;T, TProjection&gt;()</h4>
  <div class="markdown level1 summary"><p>Starts an update-and-get command with projection support for the given entity type</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public UpdateAndGet&lt;T, TProjection&gt; UpdateAndGet&lt;T, TProjection&gt;()

    where T : IEntity</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="MongoDB.Entities.UpdateAndGet-2.html">UpdateAndGet</a>&lt;T, TProjection&gt;</td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td><p>The type of entity</p>
</td>
      </tr>
      <tr>
        <td><span class="parametername">TProjection</span></td>
        <td><p>The type of the end result</p>
</td>
      </tr>
    </tbody>
  </table>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
                <h5>In This Article</h5>
                <div></div>
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            Developed by <a href='https://github.com/dj-nitehawk'>Đĵ ΝιΓΞΗΛψΚ</a> and <a href='https://github.com/dj-nitehawk/MongoDB.Entities/graphs/contributors'>contributors</a> / Licensed under <a href='https://github.com/dj-nitehawk/MongoDB.Entities/blob/master/LICENSE'>MIT</a> / Website generated by <a href='https://dotnet.github.io/docfx/'>DocFX</a>
            
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../styles/docfx.js"></script>
    <script type="text/javascript" src="../styles/main.js"></script>
  </body>
</html>
